import React from 'react';
import { Link } from 'react-router-dom';
import Header       from 'component/header/index.jsx';
import ButtonTab       from 'component/buttonTab/buttonTab.jsx';
import './order.scss'
class OrderList extends React.Component{
    constructor(props){
        super(props);
        this.state={btnList:[
            {id:'all',status:0,name:'全部'},
            {id:'payment',status:'init',name:'待付款'},
            {id:'send',status:'pass',name:'待发货'},
            {id:'harvest',status:'send',name:'待收货'},
            {id:'complete',status:'finish',name:'已完成'},
        ],
        
        }
    }
    goBack(){
        this.props.history.push('/');  
    }
    selectTab(type){
        this.setState({
            type:type  
        })
    }
    componentWillMount() {
      this.setState({
        type:this.props.match.params.type
      }) 
    }
    render(){
        return(
            <div id='orderList'>
              <Header title='订单列表' goBack={e=>{this.goBack(e)}}/>
              <div className="content viporder">
              <ButtonTab data={this.state.btnList} type={this.state.type} slectTab={(type)=>{this.selectTab(type)}} />
              </div>
            </div>
        )
    }
}
export default OrderList;